/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * This file is a part of the CANN Open Software.
 * Licensed under CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

#ifndef OP_API_INC_LEVEL2_ACL_RFFT1D_H_
#define OP_API_INC_LEVEL2_ACL_RFFT1D_H_

#include "aclnn/aclnn_base.h"
#include "aclnn_util.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief aclRfft1D First segment interface. Calculate the workspace size based on the specific calculation process.
 * Function description: Calculates the RFFT of the input tensor and outputs the result.
 * Calculation formula:
 * $$ out = Rfft(input) $$
 * Calculation chart:
 ```mermaid
 * graph LR
 * A[(self)]--->B([l0op::Rfft1D])
 * B--->C([l0op::ViewCopy])
 * C--->D[(out)]
 * ` ` `
 * @domain aclnn_ops_infer
 * Parameter description:
 * @param [in] Input
 * Input tensor. The type is FLOAT. The data format supports ND, but does not support discontinuous tensors.
 * @param [in] out
 * Output tensor. The type is FLOAT. The data format supports ND, but does not support discontinuous tensors.
 * @param [out] workspace_size: Returns the workspace size that a user needs to apply for on the NPU device.
 * @param [out] executor: Return the op executor, including the operator calculation process.
 * @return aclnnStatus: Return the status code.
 */

ACLNN_API aclnnStatus aclRfft1DGetWorkspaceSize(
    const aclTensor* self, int64_t n, int64_t dim, int64_t norm, aclTensor* out, uint64_t* workspaceSize,
    aclOpExecutor** executor);

/**
 * @brief A second interface of aclRfft1D, used to perform calculation.
 * @param [in] workspace: start address of the workspace memory allocated on the NPU device.
 * @param [in] workspace_size: size of the workspace applied on the NPU device, which is obtained by calling the first
 * segment interface aclRfft1DGetWorkspaceSize.
 * @param [in] exector: op executor, including the operator calculation process.
 * @param [in] stream: acl stream.
 * @return aclnnStatus: returned status code
 */

ACLNN_API aclnnStatus aclRfft1D(void* workspace, uint64_t workspaceSize, aclOpExecutor* executor, aclrtStream stream);

#ifdef __cplusplus
}
#endif

#endif // OP_API_INC_LEVEL2_ACL_RFFT1D_H_
